﻿<Page x:Class="LegendSample.Pages.DisconnectedLegendMode"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	  xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
    Title="DisconnectedLegendMode" Loaded="Page_Loaded">
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition/>
			<ColumnDefinition/>
		</Grid.ColumnDefinitions>

		<d3:ChartPlotter Name="plotter" NewLegendVisible="False">
			<Button Content="Add random chart" Name="addRandomChartBtn" Click="addRandomChartBtn_Click"/> 
		</d3:ChartPlotter>

		<d3:NewLegend Grid.Column="1" d3:Plotter.Plotter="{Binding ElementName=plotter}">
			<d3:NewLegend.Style>
				<Style TargetType="{x:Type d3:NewLegend}">
					<Setter Property="Template">
						<Setter.Value>
							<ControlTemplate TargetType="{x:Type d3:NewLegend}">
								<Grid>
									<ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"
									  Margin="5">
										<ItemsPresenter/>
									</ScrollViewer>
								</Grid>
							</ControlTemplate>
						</Setter.Value>
					</Setter>
				</Style>
			</d3:NewLegend.Style>
		</d3:NewLegend>
	</Grid>
</Page>
